package com.kfm.shop.controller;

import com.kfm.shop.domain.User;
import com.kfm.shop.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@Slf4j
@RequestMapping("/user")
public class UserController {

    @Resource
    private UserService userService;


    @RequestMapping("/test")
    public String test() {
        return "test";
    }

    @RequestMapping("/find/{id}")
    public User findUser(@PathVariable("id") Integer id) {
        log.info("查询{}的信息", id);
        User user = userService.findUser(id);
        log.info("查询到{}的信息为{}", id, user);
        return user;
    }
}
